#coding: utf-8
from __future__ import print_function

from java import EntityMapper

def toGpsEntity(item) :
    result = 'gps.set{}{}(({})doc.get("{}"));'.format(item[2][0].upper(), item[2][1:], item[1], item[2])
    print(result)

    #gps.setDevid((String)doc.get("devid"));

def toGpsStr(item) :
    #sb.append("devid:").append(devid);
    result = 'sb.append(",{}=").append({});'.format(item[2], item[2])
    print(result)

    #gps.setDevid((String)doc.get("devid"));


if __name__ == '__main__':
    str = """
    private Calendar time;
    private boolean valid;
    private double latitude;
    private double longitude;
    private float speed;
    private float direction;
    """

    results = EntityMapper.parse(str)
    for item in results :
        #print(item)
        #toGpsEntity(item)
        toGpsStr(item)
